<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app"></div>
</body>
<script>
    //4、组合继承(原型继承+构造函数绑定)
  function Person(head, foot, hand) {
    this.foot = foot
    this.head = head
    this.hand = hand
    this.favColor = ['red', 'green', 'yellow']
  }
  Person.prototype.sayColor = function() {
    alert("喜欢的颜色有：" + this.favColor)
  }

  function Student(id, name, head, foot, hand) {
    //Person.call(this, head, foot, hand)
    Person.apply(this, [head, foot, hand])
    this.id = id
    this.name = name
    this.show = function() {
      return "{hand=" + this.hand + ",id=" + this.id + ",name=" + this.name + ",foot=" + this.foot + ",head=" + this.head + "}"
    }
  }
  Student.prototype = new Person()
  Student.prototype.constructor = Student
  let stu = new Student(1, "tom", 1, 2, 2)
  stu.favColor.push('blue')
  stu.sayColor()
  app.innerHTML = stu.show()
</script>
</html>